package com.Jano.mapper;

import com.Jano.entity.Invitation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.relational.core.sql.In;

import java.util.List;

/**
 * description: userMapper <br>
 * date: 2022/7/12 9:46 AM <br>
 * author: zoumaoji <br>
 * version: 1.0 <br>
 */

@Mapper
public interface InvitationMapper {
    /**
     * 检索所有帖子
     *
     * @return
     */
    @Select("select id,title,summary,author,createdate createDate from invitation")
    List<Invitation> selectAllInvitation();

    /**
     * 根据标题查询帖子(动态)
     * @return
     */
    @Select("<script> " +
            "select id,title,summary,author,createdate createDate from invitation\n" +
            "    <where>\n" +
            "        <if test=\"title !=null and title !=''\">\n" +
            "            title like '%${title}%'\n" +
            "        </if>\n" +
            "    </where>" +
            "</script>")
    List<Invitation> selectInvitationByName(String title);

    /**
     * 删除帖子(id)
     * @param invitationId
     * @return
     */
    @Update("delete from invitation where id=#{invitationId}")
    Boolean deleteInvitationById(Integer invitationId);


}
